﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using Provausio.Common.Objects;
using TrainingManagement.api.Models.BusinessObjects;
using Provausio.Common.Utility.Extensions;

namespace TrainingManagement.api.Models.Data.Readers
{
    public class PositionDataReader : BusinessOperation<IDataRecord, Position>
    {
        public override Position Run(IDataRecord input)
        {
            var position = new Position
                {
                    Title = input["Title"].ToString(),
                    PositionId = input["PositionID"].DbTo<int>()
                };
            return position;
        }
    }
}